<?php

namespace Someline\Api\Controllers;

use Illuminate\Http\Request;
//use Someline\Repositories\Eloquent\PublishRepositoryEloquent;
use Illuminate\Routing\Controller;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\DB;


class PublishController extends Controller
{
    /**
     * @var PublishRepositoryEloquent
     */
   // protected $publishrepository;


    public function __construct()
    {
       // $this->repository = $publishrepository;
    }


    public function store(Request $request)
    {
        $data = $request->all();

      $nettype=$data['nettype'];
       $type=$data['type']?'121':$data['type'];
       $username=$data['username']?'121':$data['username'];
       $title=$data['title']?'121':$data['title'];
       $content=$data['content']?'121':$data['content'];
       $isImediate=$data['isImediate']?'121':$data['isImediate'];
       $publishTime=$data['publishTime']?'121':$data['publishTime'];

        $re=DB::table('setting')->insert(['nettype'=>$nettype,'type'=>$type,'username'=>$username,'title'=>$title,'content'=>$content,'isImediate'=>$isImediate,'publishTime'=>$publishTime,]);
        // print_r($re);die;
        //return $data;

        if(true)
        {
            return redirect('/');
        }

    }

}
